<template>

	<view class="container">

		<view class="header">
			<view class="jindu">
				<view class="">
					<!-- <image :src="$util.img(item.sku_image, { size: 'mid' })" @error="imageError(index)" mode="widthFix" /> -->
					<image :src="$util.img('upload/uniapp/register/audit1.png')" mode="widthFix" />
				</view>
				<view class="next"></view>
				<view class="">
					<image :src="$util.img('upload/uniapp/register/audit1.png')" mode="widthFix" />
				</view>
				<view v-if="flag == 1" class="next next-color"></view>
				<view v-if="flag !== 1" class="next "></view>
				<view class="">
					<image v-if="flag == 1" :src="$util.img('upload/uniapp/register/audit5.png')" mode="widthFix" />
					<image v-if="flag !== 1" :src="$util.img('upload/uniapp/register/audit1.png')" mode="widthFix" />
				</view>
			</view>
			<view class="header-text">
				<view>申请团长
				</view>
				<view>正在审核
				</view>
				<view v-if="flag == 1" class="small">
					审核结果
				</view>
				<view v-if="flag !== 1">
					审核结果
				</view>


			</view>
		</view>

		<view class="body">
			<image v-if="flag == 1" :src="$util.img('upload/uniapp/register/audit3.png')" mode="widthFix" />
			<image v-if="flag == 2" :src="$util.img('upload/uniapp/register/audit2.png')" mode="widthFix" />
			<image v-if="flag == 3" :src="$util.img('upload/uniapp/register/audit4.png')" mode="widthFix" />
			<text v-if="flag == 1" class="big-text">
				审核中
			</text>
			<text v-if="flag == 2" class="big-text">
				审核通过
			</text>
			<text v-if="flag == 3" class="big-text">
				审核失败
			</text>
			<text v-if="flag == 1" class="small">你的申请正在审核中，请耐心等待~</text>
			<text v-if="flag == 2" class="small">你的申请已审核通过，快开始你的商城之旅吧~</text>
			<text v-if="flag == 3" class="small">很抱歉你的申请没有通过~</text>
			<text v-if="flag == 3" class="small">{{message}}</text>

		</view>

		<view class="footer">
			<button v-if="flag == 2 ||flag == 1" class="footer-button" @click="redirectToLink('/pages/index/index/index')">商城首页</button>
			<button v-if="flag == 3" class="footer-button" @click="redirectToLink('/otherpages/member/pingtuanshang/pingtuanshang')">重新申请</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				flag: 1,
				reason: '',
				message:''
			};
		},
		onShow() {
			this.getMemberInfo()
		},
		methods: {
			redirectToLink(url) {
				this.$util.redirectTo(url, {}, 'redirectTo');
			},
			// 获取会员基础信息
			getMemberInfo() {
				let that = this
				this.$api.sendRequest({
					url: '/pintuan/api/Pintuantrader/is_apply_Pintuantrader',
					data: {},
					success: res => {
				
						if (res.code == 0) {
							this.message = res.data.message
							// let status =3
							if (res.data.code == 2) {
								// console.log('成功');
								that.flag = 2
							}
							if (res.data.code == 0) {
								// console.log('审核中');
								that.flag = 1
							}
							if (res.data.code == 1) {
								// console.log(`打回`);	
								that.flag = 3
								this.message = res.data.message
							}
							// if(status==1){
							// 	console.log('成功');
							// 	that.flag =2
							// }
							// if(status==0){
							// 	console.log('审核中');
							// 	that.flag =1
							// }
							// if(status==3){
							// 	console.log(`打回`);
							// 	that.flag =3
							// }
						} else {
							this.$util.showToast({
								title: res.message
							});
						}
					},
				});
				uni.stopPullDownRefresh();
			},


		}
	}
</script>

<style lang="scss" scoped>
	.container {
		box-sizing: border-box;
		margin: 10px 15px;

		.header {
			padding-top: 68rpx;

			.jindu {
				display: flex;
				justify-content: space-around;
				align-items: center;
				padding: 0rpx 92rpx;

				image {
					width: 23rpx;
					height: 23rpx;
				}

				.next-color {
					background-color: #AAACB1;
				}
			}

			.next {
				width: 165rpx;
				height: 1rpx;
				background-color: #FD7271;

			}

			.header-text {
				display: flex;
				justify-content: space-around;
				align-items: center;

				.small {
					color: #909399;
				}
			}
		}

		.body {
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			margin-top: 162rpx;

			image {
				width: 222rpx;
				height: 221rpx;
			}

			.big-text {
				font-size: 34rpx;
			}

			.small {
				font-size: 24rpx;
				color: #909399;
				line-height: 48rpx;
			}
		}

		.footer {
			display: flex;
			flex-direction: column;
			align-items: center;
			color: #838383;

			.footer-button {
				width: 624rpx;
				height: 90rpx;
				line-height: 90rpx;
				font-size: 30rpx;
				background: #FF4544;
				margin: 60rpx 0;
				color: #FFFFFF;
			}
		}
	}
</style>
